#ifndef __EKOS_KERNEL_LAPIO_H__
#define __EKOS_KERNEL_LAPIO_H__

/* The physical addr of LAPIO Registers */
/* After the mp_setup() in mp.c, the lapic_phys == 0 iff there is no apic */
extern physaddr_t lapic_phys;
/* The virtual address mapping of LAPIC, defined in inc/layout.h */
/* The symbol is defined in kernel.S */
extern volatile uint32_t lapic[];

int  lapic_init(void);
void lapic_eoi();
int  lapic_startap(uint8_t apicid, uint32_t addr);

/* Get the current cpu id by reading the LAPIC register */
int cur_cpu(void);
/* Send a interrupt to another cpu and wait the cpu to ack */
int send_ipi(int cpu, int func, int arg0, int arg1, int arg2, int arg3);

#endif
